import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    key: 'id',
    align: "center",
  }, {
    title: '交易单号',
    key: 'danhao',
    align: "center",
  }, {
    title: '用户id',
    key: 'user_id',
    align: "center",
  }, {
    title: '小程序名称',
    key: 'pt_attr',
    align: "center",
    render(row) {
      if (row.pt_attr == 1) {
        return h(
          NTag,
          {
            type: 'default',
          },
          {
            default: () => ('微信小程序'),
          },
        );
      } else if (row.pt_attr == 2) {
        return h(
          NTag,
          {
            type: 'default',
          },
          {
            default: () => ('抖音小程序'),
          },
        );
      } else if (row.pt_attr == 3) {
        return h(
          NTag,
          {
            type: 'default',
          },
          {
            default: () => ('支付宝小程序'),
          },
        );
      }
    }
  }, {
    title: '小程序appid',
    key: 'appid',
    align: "center",
  }, {
    title: '付款金额',
    key: 'money',
    align: "center",
  }, {
    title: '赠送金额',
    key: 'zsmoney',
    align: "center",
  }, {
    title: '充值类型',
    key: 'leixing',
    align: "center",
    render(row) {
      if (row.leixing == 0) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('单次充值'),
          },
        );
      } else if (row.leixing == 1) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('充值套餐'),
          },
        );
      } else if (row.leixing == 3) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('后台充值'),
          },
        );
      }
    }
  }, {
    title: '状态',
    key: 'status',
    align: "center",
    render(row) {
      if (row.status == 0) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('待付款'),
          },
        );
      } else if (row.status == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('已付款'),
          },
        );
      }
    }
  }, {
    title: '创建时间',
    key: 'create_time',
    align: "center",
  },
];
